package com.itheima.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.goods.pojo.Address;
import com.itheima.user.mapper.AddressMapper;
import com.itheima.user.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements AddressService {
    @Autowired
    private AddressMapper addressMapper;

    @Override
    public List<Address> findByUserName(String userName) {
        LambdaQueryWrapper<Address> queryWrapper = Wrappers.<Address>lambdaQuery();
        queryWrapper.eq(Address::getUserName, userName);
        return addressMapper.selectList(queryWrapper);
    }
}
